﻿using pcDAL;
using pcObjectLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace pcBLL
{
    public class PunchBLL
    {
        public PunchObjectLibrary opUserOpenLog(int opUserId)
        {
            PunchObjectLibrary obj = new PunchObjectLibrary();
            PunchDAL pd = new PunchDAL();
            obj = pd.opUserOpenLog(opUserId: opUserId);
            return obj;
        }

        public List<PunchObjectLibrary> GetOpenLogs(int opUserId)
        {
            List<PunchObjectLibrary> obj = new List<PunchObjectLibrary>();
            PunchDAL pd = new PunchDAL();
            obj = pd.GetOpenLogs(opUserId: opUserId);
            return obj;
        }

        public string PunchIn(int userId, TimeSpan punchTime, string ipAddress)
        {
            PunchDAL pd = new PunchDAL();
            return pd.PunchIn(userId: userId, punchTime: punchTime, ipAddress: ipAddress);
        }

        public string PunchOut(int userId, int pId, TimeSpan punchTime, string ipAddress)
        {
            PunchDAL pd = new PunchDAL();
            return pd.PunchOut(userId: userId, punchId: pId, punchTime: punchTime, ipAddress: ipAddress);
        }

        public List<PunchObjectLibrary> Search(int operatingUserId,int userId, DateTime stDate, DateTime enDate)
        {
            PunchDAL pd = new PunchDAL();
            return pd.Search(operatingUserId: operatingUserId, userId: userId, stDate: stDate, enDate: enDate);
        }

        public bool Approve(PunchObjectLibrary punchObj, int opUserId)
        {
            PunchDAL pd = new PunchDAL();
            return pd.Approve(punchObj: punchObj, opUserId: opUserId);
        }
    }
}
